import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        isShowLoading: false, // 全局 loading
        // 左侧菜单栏数据
        menuItems: [
            {
                type: 'ios-browsers-outline',
                name: 'data',
                text: '数据概览',
            },
            {
                type: 'ios-list-box-outline',
                name: 'rentArea',
                text: '面积租金散点图',
            },
            {
                type: 'ios-cloud-outline',
                name: 'houseTag',
                text: '标签词云',
            },
            {
                type: 'ios-stats-outline',
                name: 'houseRent',
                text: '租金分析',
            },
            {
                type: 'ios-paper-outline',
                name: 'houseNum',
                text: '房源数量',
            },
            {
                type: 'ios-information-circle-outline',
                name: 'houseRentAvg',
                text: '平均房租',
            },
            {
                type: 'ios-paper-plane-outline',
                name: 'yuce',
                text: '租金预测',
            },
            {
                type: 'md-lock',
                name: 'password',
                text: '修改密码',
                hidden: true,
            },
            {
                type: 'md-person',
                name: 'getdata',
                text: '获取数据',
                hidden: true,
            },
            {
                type: 'md-person',
                name: 'datalog',
                text: '爬取日志',
                hidden: true,
            },
        ],
    },
    mutations: {
        setMenus(state, items) {
            state.menuItems = [...items]
        },
        setLoading(state, isShowLoading) {
            state.isShowLoading = isShowLoading
        },
    },
})

export default store
